import random
quit = 1  # 0代表不退出 1代表退出
while quit == 1:
    print("请选择猜数字的难度：1(初级 数字1~100)，2(中级 数字1~500),3(高级 数字1~10000)")
    item = 100
    level = int(input())
    if level == 1:
        pass
    elif level == 2:
        item = 500
    elif level == 3:
        item = 10000
    answer = random.randint(1,item)
    guess = int(input("请输入你猜的数："))
    flag = 0
    while flag == 0:
        if guess == answer:
            print("太棒了!恭喜你猜对了!")
            flag = 1
        elif guess > answer:
            print("猜的数大了",end=" ")
            guess = int(input("请输入小一点的数："))
        elif guess < answer:
            print("猜的数小了",end=" ")
            guess = int(input("请输入大一点的数："))
    quit = int(input("请选择 0(退出) 1(继续):"))